package com.nes.fiber.server;

import co.paralleluniverse.fibers.Fiber;
import co.paralleluniverse.fibers.FiberAsync;

public abstract class MyFiberAsync extends FiberAsync<String, RuntimeException> implements MyCallback {

    private final Fiber fiber;

    public MyFiberAsync() {
        this.fiber = Fiber.currentFiber();
    }

    @Override
    protected void asyncCompleted(String result) {
        //todo
        System.out.println("xxxxxx=" + result);
        super.asyncCompleted(result);
    }

    @Override
    public void call(String str) {
        asyncCompleted(str);
    }

    @Override
    public void fail(RuntimeException e) {
        super.asyncFailed(e);
    }
}